// Author: Bjorn Schobben

#ifndef PROPERTIESDIALOG_H
#define PROPERTIESDIALOG_H

#include <QDialog>
#include <QVBoxLayout>
#include "Properties.h"
#include "ColorButton.h"

// Dialog to display game properties
class PropertiesDialog: public QDialog, public Properties
{
	Q_OBJECT

public:
	//Constructors
	PropertiesDialog(QWidget *parent = 0);
	PropertiesDialog(QWidget *parent, const Properties& properties);

	//Destructor
	virtual ~PropertiesDialog();


protected:

signals:
	void accepted(const Properties&);

private slots:
	// Slot for when color count was changed
	void ColorCountChanged(int value);
	// Slot for when a color button was clicked
	void ColorButtonClicked(ColorButton *button, Color color);

	// Accepted/Rejected the properties
	void OnAccepted();
	void OnRejected();

private:
	//Helper operations
	void UpdateButtonStates();
	void UpdateColors();
	void SetupUi();
	void SetupColorButtons();
	void SetupColorSpinBox();
	
	//List of color buttons
	ColorButton* colorButtons[MAXCOLOR];

	QVBoxLayout *vboxLayout;
};

#endif //PROPERTIESDIALOG_H